--[[

Node box (shape) basic geometry 

Copyright 2014 Tiberiu CORBU
Authors: Tiberiu CORBU

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
--]]

if not element_portals then
	element_portals = {}
end

if not element_portals.node_box then 
	element_portals.node_box = {}
end

-- Node box definitions

local normal_box = {
	type = "fixed",
	fixed = {
		{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}
	}
}

local cylinder_box_14 =  {
		type = "fixed",
		fixed = {
			{0.4375, -0.5, -0.125, 0.5, 0.5, 0.125}, -- NodeBox1
			{0.375, -0.5, 0.125, 0.4375, 0.5, 0.25}, -- NodeBox2
			{0.3125, -0.5, 0.25, 0.375, 0.5, 0.3125}, -- NodeBox3
			{0.25, -0.5, 0.25, 0.3125, 0.5, 0.375}, -- NodeBox4
			{0.125, -0.5, 0.375, 0.25, 0.5, 0.4375}, -- NodeBox5
			{-0.125, -0.5, 0.4375, 0.125, 0.5, 0.5}, -- NodeBox6
			{-0.25, -0.5, 0.375, -0.125, 0.5, 0.4375}, -- NodeBox7
			{-0.3125, -0.5, 0.25, -0.25, 0.5, 0.375}, -- NodeBox8
			{-0.375, -0.5, 0.25, -0.3125, 0.5, 0.3125}, -- NodeBox9
			{-0.4375, -0.5, 0.125, -0.375, 0.5, 0.25}, -- NodeBox10
			{-0.5, -0.5, -0.125, -0.4375, 0.5, 0.125}, -- NodeBox11
			{-0.125, -0.5, -0.5, 0.125, 0.5, -0.4375}, -- NodeBox12
			{-0.25, -0.5, -0.4375, -0.125, 0.5, -0.375}, -- NodeBox13
			{-0.4375, -0.5, -0.25, -0.375, 0.5, -0.125}, -- NodeBox14
			{-0.375, -0.5, -0.3125, -0.25, 0.5, -0.25}, -- NodeBox15
			{-0.3125, -0.5, -0.375, -0.25, 0.5, -0.3125}, -- NodeBox18
			{0.125, -0.5, -0.4375, 0.25, 0.5, -0.375}, -- NodeBox19
			{0.375, -0.5, -0.25, 0.4375, 0.5, -0.125}, -- NodeBox20
			{0.25, -0.5, -0.375, 0.375, 0.5, -0.3125}, -- NodeBox21
			{0.3125, -0.5, -0.3125, 0.375, 0.5, -0.25}, -- NodeBox22
		}
	}

local box_with_carved_cone =  {
		type = "fixed",
		fixed = {
			{-0.1875, -0.5, 0.375, 0.1875, 0.5, 0.5}, -- NodeBox3
			{-0.25, -0.5, 0.3125, -0.1875, 0.5, 0.5}, -- NodeBox4
			{-0.3125, -0.5, 0.25, -0.25, 0.5, 0.5}, -- NodeBox5
			{-0.375, -0.5, 0.1875, -0.3125, 0.5, 0.5}, -- NodeBox6
			{-0.5, -0.5, -0.5, -0.375, 0.5, 0.5}, -- NodeBox7
			{-0.375, -0.5, -0.5, -0.3125, 0.5, -0.1875}, -- NodeBox8
			{-0.3125, -0.5, -0.5, -0.25, 0.5, -0.25}, -- NodeBox9
			{-0.25, -0.5, -0.5, -0.1875, 0.5, -0.3125}, -- NodeBox10
			{-0.1875, -0.5, -0.5, 0.1875, 0.5, -0.375}, -- NodeBox11
			{0.1875, -0.5, -0.5, 0.25, 0.5, -0.3125}, -- NodeBox12
			{0.25, -0.5, -0.5, 0.3125, 0.5, -0.25}, -- NodeBox13
			{0.3125, -0.5, -0.5, 0.375, 0.5, -0.1875}, -- NodeBox14
			{0.375, -0.5, -0.5, 0.5, 0.5, 0.5}, -- NodeBox15
			{0.3125, -0.5, 0.1875, 0.375, 0.5, 0.5}, -- NodeBox16
			{0.25, -0.5, 0.25, 0.3125, 0.5, 0.5}, -- NodeBox17
			{0.1875, -0.5, 0.3125, 0.25, 0.5, 0.5}, -- NodeBox18
			{-0.1875, -0.5, 0.3125, 0.1875, 0.375, 0.375}, -- NodeBox19
			{-0.25, -0.5, 0.25, -0.125, 0.375, 0.3125}, -- NodeBox20
			{-0.3125, -0.5, 0.125, -0.25, 0.375, 0.25}, -- NodeBox21
			{-0.375, -0.5, -0.1875, -0.3125, 0.375, 0.1875}, -- NodeBox22
			{-0.3125, -0.5, -0.25, -0.25, 0.375, -0.125}, -- NodeBox23
			{-0.25, -0.5, -0.3125, -0.125, 0.375, -0.25}, -- NodeBox24
			{-0.1875, -0.5, -0.375, 0.1875, 0.375, -0.3125}, -- NodeBox25
			{0.125, -0.5, -0.3125, 0.25, 0.375, -0.25}, -- NodeBox26
			{0.25, -0.5, -0.25, 0.3125, 0.375, -0.125}, -- NodeBox27
			{0.3125, -0.5, -0.1875, 0.375, 0.375, 0.1875}, -- NodeBox28
			{0.25, -0.5, 0.125, 0.3125, 0.375, 0.25}, -- NodeBox29
			{0.125, -0.5, 0.25, 0.25, 0.375, 0.3125}, -- NodeBox30
			{-0.125, -0.5, 0.25, 0.125, 0.25, 0.3125}, -- NodeBox31
			{-0.25, -0.5, 0.1875, -0.125, 0.25, 0.25}, -- NodeBox32
			{-0.25, -0.5, 0.125, -0.1875, 0.25, 0.1875}, -- NodeBox33
			{-0.3125, -0.5, -0.125, -0.25, 0.25, 0.125}, -- NodeBox34
			{-0.25, -0.5, -0.1875, -0.1875, 0.25, -0.125}, -- NodeBox35
			{-0.25, -0.5, -0.25, -0.125, 0.25, -0.1875}, -- NodeBox36
			{-0.125, -0.5, -0.3125, 0.125, 0.25, -0.25}, -- NodeBox37
			{0.125, -0.5, -0.25, 0.1875, 0.25, -0.1875}, -- NodeBox38
			{0.1875, -0.5, -0.25, 0.25, 0.25, -0.125}, -- NodeBox39
			{0.25, -0.5, -0.125, 0.3125, 0.25, 0.125}, -- NodeBox40
			{0.1875, -0.5, 0.125, 0.25, 0.25, 0.1875}, -- NodeBox41
			{0.125, -0.5, 0.1875, 0.25, 0.25, 0.25}, -- NodeBox42
			{-0.125, -0.5, 0.1875, 0.125, 0.125, 0.25}, -- NodeBox43
			{-0.1875, -0.5, 0.125, -0.125, 0.125, 0.1875}, -- NodeBox44
			{-0.25, -0.5, -0.125, -0.1875, 0.125, 0.125}, -- NodeBox45
			{-0.1875, -0.5, -0.1875, -0.125, 0.125, -0.125}, -- NodeBox46
			{-0.125, -0.5, -0.25, 0.125, 0.125, -0.1875}, -- NodeBox47
			{0.125, -0.5, -0.1875, 0.1875, 0.125, -0.125}, -- NodeBox48
			{0.1875, -0.5, -0.125, 0.25, 0.125, 0.125}, -- NodeBox49
			{0.125, -0.5, 0.125, 0.1875, 0.125, 0.1875}, -- NodeBox50
			{-0.125, -0.5, 0.125, 0.125, 0, 0.1875}, -- NodeBox51
			{-0.125, -0.5, 0.0625, -0.0625, 0, 0.125}, -- NodeBox52
			{-0.1875, -0.5, -0.125, -0.125, 0, 0.125}, -- NodeBox53
			{-0.125, -0.5, -0.125, -0.0625, 0, -0.0625}, -- NodeBox54
			{-0.125, -0.5, -0.1875, 0.125, 0, -0.125}, -- NodeBox55
			{0.0625, -0.5, -0.125, 0.125, 0, -0.0625}, -- NodeBox56
			{0.125, -0.5, -0.125, 0.1875, 0, 0.125}, -- NodeBox57
			{0.0625, -0.5, 0.0625, 0.125, 0, 0.125}, -- NodeBox58
			{-0.0625, -0.5, 0.0625, 0.0625, -0.125, 0.125}, -- NodeBox59
			{-0.125, -0.5, -0.0625, -0.0625, -0.125, 0.0625}, -- NodeBox60
			{-0.0625, -0.5, -0.125, 0.0625, -0.125, -0.0625}, -- NodeBox61
			{0.0625, -0.5, -0.0625, 0.125, -0.125, 0.0625}, -- NodeBox62
			{-0.0625, -0.5, -0.0625, 0.0625, -0.25, 0.0625}, -- NodeBox63
		}
	}

local sphere_in_hollow_box = {
		type = "fixed",
		fixed = {
			{-0.125, -0.375, -0.125, 0.125, 0.375, 0.125}, -- NodeBox6
			{-0.25, -0.3125, -0.125, 0.25, 0.3125, 0.125}, -- NodeBox7
			{-0.125, -0.3125, -0.25, 0.125, 0.3125, 0.25}, -- NodeBox9
			{-0.1875, -0.3125, -0.1875, 0.1875, 0.3125, 0.1875}, -- NodeBox15
			{-0.3125, -0.25, -0.125, 0.3125, 0.25, 0.125}, -- NodeBox16
			{-0.125, -0.25, -0.3125, 0.125, 0.25, 0.3125}, -- NodeBox17
			{-0.1875, -0.25, -0.25, 0.1875, 0.25, 0.25}, -- NodeBox19
			{-0.25, -0.25, -0.1875, 0.25, 0.25, 0.1875}, -- NodeBox20
			{-0.25, -0.1875, -0.25, 0.25, 0.1875, 0.25}, -- NodeBox21
			{-0.3125, -0.1875, -0.1875, 0.3125, 0.1875, 0.1875}, -- NodeBox22
			{-0.1875, -0.1875, -0.3125, 0.1875, 0.1875, 0.3125}, -- NodeBox23
			{-0.125, -0.125, -0.375, 0.125, 0.125, 0.375}, -- NodeBox24
			{-0.375, -0.125, -0.125, 0.375, 0.125, 0.125}, -- NodeBox25
			{-0.3125, -0.125, -0.1875, 0.3125, 0.125, 0.1875}, -- NodeBox26
			{-0.1875, -0.125, -0.3125, 0.1875, 0.125, 0.3125}, -- NodeBox27
			{-0.25, -0.125, -0.25, 0.25, 0.125, 0.25}, -- NodeBox28
			{-0.5, -0.5, -0.5, -0.3125, 0.5, -0.4375}, -- NodeBox30
			{-0.5, -0.5, -0.4375, -0.4375, 0.5, -0.3125}, -- NodeBox31
			{-0.5, -0.5, 0.4375, -0.3125, 0.5, 0.5}, -- NodeBox32
			{-0.5, -0.5, 0.3125, -0.4375, 0.5, 0.4375}, -- NodeBox33
			{0.4375, -0.5, 0.3125, 0.5, 0.5, 0.5}, -- NodeBox34
			{0.3125, -0.5, 0.4375, 0.5, 0.5, 0.5}, -- NodeBox35
			{0.3125, -0.5, -0.5, 0.5, 0.5, -0.4375}, -- NodeBox36
			{0.4375, -0.5, -0.4375, 0.5, 0.5, -0.3125}, -- NodeBox37
			{-0.5, -0.5, -0.5, 0.5, -0.4375, -0.3125}, -- NodeBox38
			{-0.5, -0.5, 0.3125, 0.5, -0.4375, 0.5}, -- NodeBox39
			{0.3125, -0.5, -0.5, 0.5, -0.4375, 0.5}, -- NodeBox40
			{-0.5, -0.5, -0.5, -0.3125, -0.4375, 0.5}, -- NodeBox41
			{-0.5, -0.5, -0.5, 0.5, -0.3125, -0.4375}, -- NodeBox42
			{0.4375, -0.5, -0.5, 0.5, -0.3125, 0.5}, -- NodeBox43
			{-0.5, -0.5, -0.5, -0.4375, -0.3125, 0.5}, -- NodeBox44
			{-0.5, -0.5, 0.4375, 0.5, -0.3125, 0.5}, -- NodeBox45
			{-0.5, 0.4375, -0.5, -0.3125, 0.5, 0.5}, -- NodeBox46
			{-0.5, 0.4375, 0.3125, 0.5, 0.5, 0.5}, -- NodeBox47
			{0.3125, 0.4375, -0.5, 0.5, 0.5, 0.5}, -- NodeBox48
			{-0.5, 0.4375, -0.5, 0.5, 0.5, -0.3125}, -- NodeBox49
			{-0.5, 0.3125, 0.4375, 0.5, 0.5, 0.5}, -- NodeBox50
			{-0.5, 0.3125, -0.5, -0.4375, 0.5, 0.5}, -- NodeBox51
			{-0.5, 0.3125, -0.5, 0.5, 0.5, -0.4375}, -- NodeBox52
			{0.4375, 0.3125, -0.5, 0.5, 0.5, 0.5}, -- NodeBox53
		}
	} 

-- Exports
element_portals.node_box.normal_box = normal_box
element_portals.node_box.cylinder_box_14 = cylinder_box_14
element_portals.node_box.box_with_carved_cone = box_with_carved_cone
element_portals.node_box.sphere_in_hollow_box = sphere_in_hollow_box
